package com.example.ssyinitlearn.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.ssyinitlearn.entity.UserRoleRelationEntity;
import com.example.ssyinitlearn.service.UserRoleRelationService;
import com.example.ssyinitlearn.common.utils.PageUtils;
import com.example.ssyinitlearn.common.utils.R;



/**
 * 
 *
 * @author kamistoat
 * @email linjianshanke@163.com
 * @date 2022-07-28 14:36:45
 */
@RestController
@RequestMapping("ssyinitlearn/userrolerelation")
public class UserRoleRelationController {
    @Autowired
    private UserRoleRelationService userRoleRelationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ssyinitlearn:userrolerelation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userRoleRelationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("ssyinitlearn:userrolerelation:info")
    public R info(@PathVariable("id") Long id){
		UserRoleRelationEntity userRoleRelation = userRoleRelationService.getById(id);

        return R.ok().put("userRoleRelation", userRoleRelation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ssyinitlearn:userrolerelation:save")
    public R save(@RequestBody UserRoleRelationEntity userRoleRelation){
		userRoleRelationService.save(userRoleRelation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ssyinitlearn:userrolerelation:update")
    public R update(@RequestBody UserRoleRelationEntity userRoleRelation){
		userRoleRelationService.updateById(userRoleRelation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ssyinitlearn:userrolerelation:delete")
    public R delete(@RequestBody Long[] ids){
		userRoleRelationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
